package com.tarena.day0917;

public class Point {//类体
	int x;//属性X
	int y;//属性Y
	//方法，功能：横向移动当前点
	public void addx(int dx){
		x=x+dx;
	}
	//方法，功能：纵向移动当前点
	public void addy(int dy){
		y=y+dy;
	}
	public double moveTo(int x,int y){
		int dx=this.x-x;
		int dy=this.y-y;
		double distance=Math.sqrt(dx*dx+dy*dy);
		this.x=x;
		this.y=y;
		return distance;
	}
	
}//类体结束
//Point p1=new Point();
//P1.x=100;
//p1.y=200;
//P1.addx(2);
//p1.moveTo(150,100);

